package com.naiterui.ehp.bs.patient.repository;

import com.naiterui.common.repository.core.BaseJpaRepository;
import com.naiterui.ehp.bp.domain.DrFollowUpRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * 随访任务
 *
 * @author yangfuya
 * @since 2022/1/5
 */
@Repository
public interface IApDrFollowUpRecordRepository extends BaseJpaRepository<DrFollowUpRecord, Long> {

    /**
     * 分页获取患者随访列表
     *
     * @param patientId
     * @param status
     * @param pageable
     * @return
     */
    Page<DrFollowUpRecord> findByPatientIdAndStatus(Long patientId, Integer status, Pageable pageable);

    /**
     * 列表
     *
     * @param patientId
     * @param status
     * @return
     */
    List<DrFollowUpRecord> findByPatientIdAndStatusOrderByEndTimeAsc(Long patientId, Integer status);

    /**
     * 查询患者某天的问诊计划
     *
     * @param date
     * @param pageable
     * @return
     */

    Page<DrFollowUpRecord> findByPatientIdAndBeginTime(Long patientId, Date date, Pageable pageable);

    /**
     * 查询患者随访日历页月份数据
     *
     * @param patientId
     * @param startTime
     * @param endTime
     * @return
     */
    List<DrFollowUpRecord> findByPatientIdAndBeginTimeBetween(Long patientId, Date startTime, Date endTime);

    List<DrFollowUpRecord> findAllByFollowNo(String followNo);

    List<DrFollowUpRecord> findByBeginTime(Date date);

    List<DrFollowUpRecord> findByTypeAndBeginTimeAndStatus(int typeSubsequent, Date toJdkDate, int notStarted);

    List<DrFollowUpRecord> findByBeginTimeAndStatus(Date dateTime, int notStarted);
}
